﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using YArchitech.Controls;

namespace HYElectricSystemDiagram.FormSet
{
	public partial class FormNewCase : HYBaseForm
	{
		public FormNewCase(string name, System.Windows.Forms.ComboBox cb)
		{
			this.InitializeComponent();
			this.tbCaseName.Text = name;
			this.strName = name;
			this.cbbox = cb;
		}

		private void btnOk_Click(object sender, EventArgs e)
		{
			this.strName = this.tbCaseName.Text;
			if (string.IsNullOrEmpty(this.strName))
			{
				YJKMessageBox.Show("新建名称不能为空!");
				return;
			}
			foreach (object obj in this.cbbox.Items)
			{
				string value = obj.ToString().Replace("(当前方案)", "");
				if (this.strName.Equals(obj.ToString()) || this.strName.Equals(value))
				{
					YJKMessageBox.Show("新建名称与当前项目重名!");
					return;
				}
			}
			base.DialogResult = DialogResult.OK;
			base.Close();
		}

		private void btnCancle_Click(object sender, EventArgs e)
		{
			base.Close();
		}

		public string strName = "";

		private System.Windows.Forms.ComboBox cbbox;
	}
}
